﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bpms;
using Bpms.Entity;
using Bpms.Cache;
using Bpms.Bll;
using Bpms.Config;
using Bpms.Common;
using Bpms.Mail;
using Bpms.Log;

namespace Web
{
    public partial class WebForm1 : Bpms.Control.BasePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            zyj z = new zyj();
            z.name = "zyj";
            Test(z);
            Response.Write(z.name + "<br />");

            //  double exactDistance = 0.000000001;
            // Response.Write(Convert.ToInt32(Math.Ceiling(System.Math.Log(exactDistance / 1000, 1.0 / 15))));

            //Response.Write(Utility.GetFormString("txt1"));

            #region testing
            // Bpms.Log.LogAdapter logger = new CacheLogAdapter();
            //logger.WriteLog("cache testing");
            //CacheContext cache = CacheContext.GetCacheService(new DefaultCache());
            //cache.RemoveObject("test");
            //string str = cache.RetrieveObject("test") as string;
            //if (null == str)
            //{
            //    str = "zyj";
            //    cache.AddObject("test", str);
            //}

            // Response.Write(TimeZoneInfo.Local.BaseUtcOffset);
            //  Response.End();

            //CacheContext cache = CacheContext.GetCacheService(new ProjectCache());
            //===========================================
            //DateTime dt = DateTime.Now;
            //long time_t_1;
            //long time_t_2;
            //DateTime dt1 = DateTime.Now;
            //for (int i = 0; i < 1000000; ++i)
            //{
            //    time_t_1 = DateTime2Time_T(dt);
            //}
            //DateTime dt2 = DateTime.Now;
            //for (int j = 0; j < 1000000; ++j)
            //{
            //    time_t_2 = DateTimeToTime_T(dt);
            //}
            //DateTime dt3 = DateTime.Now;

            //Response.Write((dt2 - dt1).TotalSeconds + "<br />");
            //Response.Write((dt3 - dt2).TotalSeconds);


            //  Bpms.Bll.Order.SetOrderStrategy(new CustomerOrder());

            // Response.Write(Bpms.Bll.Order.GetInfo(1));
            //=========================================
            //CustomerOrderInfo info = new CustomerOrderInfo();
            //info.OrderId = 1;
            //info.OrderNumber = "aaa";
            //info.Test = "test";

            //OrderInfo order = info;


            //Response.Write((order as CustomerOrderInfo).Test);


            //OrderInfo order = new OrderInfo();
            // order.OrderId = 1;
            // order.OrderNumber = "aaaa";

            //order = SerializationHelper.Load(typeof(OrderInfo), "/orderinfo.xml") as OrderInfo;

            // Response.Write(order.OrderNumber);
            //DbConfigFileManager.ConfigInfo = new DbConfigInfo();
            //DbConfigFileManager manager = new DbConfigFileManager();

            // manager.SaveConfig();
            // Response.Write(ConfigContext.GetDBConnectString);
            //Response.Write(Email.BpmsSystemSmtpMail("aaa", "yingjie_zhang@celestone.com.cn", "fff", "gfdgfd"));

            //List<BaseConfigFileManager> list = new List<BaseConfigFileManager>();
            //list.Add(new GeneralConfigFileManager());
            //list.Add(new EmailConfigFileManager());
            //list.Add(new DbConfigFileManager());

            //GeneralConfigFileManager.ConfigInfo = new GeneralConfigInfo();
            //EmailConfigFileManager.ConfigInfo = new EmailConfigInfo();
            //DbConfigFileManager.ConfigInfo = new DbConfigInfo();

            //foreach (BaseConfigFileManager manager in list)
            //{
            //    manager.SaveConfig();
            //}

            #endregion


            //LogAdapter log = new CacheLogAdapter();
            //  log.WriteLog("Cache:[test] RemovedReason:[过期]" + Request.Url+"<br />");

            //   LogAdapter log = new ExceptionLogAdapter();
            //log.WriteLog(Request.Url.ToString(), new Exception("dd"));

            // Type t = Order.GetType("CustomerOrder");
            //// System.Reflection.MethodInfo[] methods = t.GetMethods();
            // foreach (System.Reflection.MethodInfo minfo in methods)
            //   {
            //     Response.Write(minfo.ToString());
            // }

            // Order.DBChanged += new DBChangedEventHandler(RemoveCache);
            //  Order.WriteLog += new LogEventHandler(WriteLog);

            //string str = "";
            //VerifyInfo info = VerifyHelper.StartVerify(str)
            //                        .IsNotNullOrEmpty("不能为空")
            //                        .IsEmail("Email格式不正确")
            //                        .EndVerify();
            //if (!info.Status)
            //{
            //    Response.Write(info.Message);
            //}


            //Type type = typeof(FieldType);
            //string[] values = Enum.GetNames(type);
            //Array list = Enum.GetNames(type); 




        }


        protected void btn1_post(object sender, EventArgs e)
        {
            this.Alert("Hello world!");
        }

        private void Test(zyj d)
        {
            // d = new zyj();
            d = null;
            //Response.Write(d.name + "<br />");
            // d.name = "changed";
            // Response.Write(d.name + "<br />");
        }
    }

    public class zyj
    {
        public string name = "default";
    }



}
